{% extends 'movie/base.html' %}
{% block content %}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
     <title>词云展示</title>
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5.4.1/dist/echarts.min.js"></script>
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-wordcloud@2.1.0/dist/echarts-wordcloud.min.js"></script>
    <style>
        body {
            background-color: transparent; /* Replace with your template's background color */
        }

        #main {
            background-color: transparent; /* Replace with your template's background color */
        }
    </style>
</head>
<body>
    <h1 style="color: white;">电影发行国词云分析</h1>

  <div class="buttons">
    <button onclick="window.location.href='/movie/year-count'">电影数量变化趋势</button>
    <button onclick="window.location.href='/movie/wordcloud'">词云分析</button>
    <button onclick="window.location.href='/movie/movie-hot'">电影热度</button>
      <button onclick="window.location.href='/movie/map'">分布</button>
  </div>
    <div id="main" style="width: 800px; height: 600px"></div>
    <script>
        onload = function () {
            var data = {
                value: [
                    {
                        "name": "美国",
                        "value": 1624
                    },
                    {
                        "name": "中国大陆",
                        "value": 1459
                    },
                    {
                        "name": "印度",
                        "value": 27
                    },
                    {
                        "name": "法国",
                        "value": 182
                    },
                    {
                        "name": "意大利",
                        "value": 43
                    },
                    {
                        "name": "英国",
                        "value": 305
                    },
                    {
                        "name": "泰国",
                        "value": 22
                    },
                    {
                        "name": "日本",
                        "value": 337
                    },
                    {
                        "name": "阿根廷",
                        "value": 4
                    },
                    {
                        "name": "澳大利亚",
                        "value": 20
                    },
                    {
                        "name": "韩国",
                        "value": 48
                    },
                    {
                        "name": "西德",
                        "value": 5
                    },
                    {
                        "name": "丹麦",
                        "value": 6
                    },
                    {
                        "name": "加拿大",
                        "value": 26
                    },
                    {
                        "name": "德国",
                        "value": 61
                    },
                    {
                        "name": "爱尔兰",
                        "value": 15
                    },
                    {
                        "name": "奥地利",
                        "value": 7
                    },
                    {
                        "name": "芬兰",
                        "value": 9
                    },
                    {
                        "name": "俄罗斯",
                        "value": 33
                    },
                    {
                        "name": "越南",
                        "value": 1
                    },
                    {
                        "name": "新加坡",
                        "value": 1
                    },
                    {
                        "name": "西班牙",
                        "value": 30
                    },
                    {
                        "name": "瑞典",
                        "value": 11
                    },
                    {
                        "name": "新西兰",
                        "value": 6
                    },
                    {
                        "name": "苏联",
                        "value": 23
                    },
                    {
                        "name": "墨西哥",
                        "value": 3
                    },
                    {
                        "name": "阿联酋",
                        "value": 2
                    },
                    {
                        "name": "比利时",
                        "value": 4
                    },
                    {
                        "name": "马耳他",
                        "value": 1
                    },
                    {
                        "name": "哥伦比亚",
                        "value": 2
                    },
                    {
                        "name": "荷兰",
                        "value": 7
                    },
                    {
                        "name": "匈牙利",
                        "value": 2
                    },
                    {
                        "name": "挪威",
                        "value": 4
                    },
                    {
                        "name": "以色列",
                        "value": 4
                    },
                    {
                        "name": "伊朗",
                        "value": 1
                    },
                    {
                        "name": "巴西",
                        "value": 2
                    },
                    {
                        "name": "瑞士",
                        "value": 3
                    },
                    {
                        "name": "印度尼西亚",
                        "value": 1
                    },
                    {
                        "name": "波兰",
                        "value": 9
                    },
                    {
                        "name": "菲律宾",
                        "value": 1
                    },
                    {
                        "name": "南斯拉夫",
                        "value": 3
                    },
                    {
                        "name": "秘鲁",
                        "value": 1
                    },
                    {
                        "name": "保加利亚",
                        "value": 1
                    },
                    {
                        "name": "爱沙尼亚",
                        "value": 1
                    },
                    {
                        "name": "捷克",
                        "value": 5
                    },
                    {
                        "name": "智利",
                        "value": 1
                    },
                    {
                        "name": "委内瑞拉",
                        "value": 1
                    },
                    {
                        "name": "斯洛伐克",
                        "value": 1
                    },
                    {
                        "name": "捷克斯洛伐克",
                        "value": 2
                    },
                    {
                        "name": "南非",
                        "value": 2
                    },
                    {
                        "name": "波黑",
                        "value": 1
                    },
                    {
                        "name": "阿尔及利亚",
                        "value": 1
                    },
                    {
                        "name": "塞尔维亚",
                        "value": 1
                    },
                    {
                        "name": "马来西亚",
                        "value": 1
                    },
                    {
                        "name": "葡萄牙",
                        "value": 2
                    },
                    {
                        "name": "罗马尼亚",
                        "value": 1
                    }
                ]
            };

            var myChart = echarts.init(document.getElementById('main'));
            myChart.setOption({
                backgroundColor: 'transparent', /* Set the background color to match your template */
                tooltip: {
                    show: false
                },
                series: [{
                    type: 'wordCloud',
                    gridSize: 2,
                    sizeRange: [24,70],
                    rotationRange: [-45, 0, 45, 90],
                    textStyle: {
                        normal: {
                            color: function() {
                                return 'rgb(' +
                                        Math.round(Math.random() * 255) +
                                        ', ' + Math.round(Math.random() * 255) +
                                        ', ' + Math.round(Math.random() * 255) + ')'
                            }
                        }
                    },
                    left: 'center',
                    top: 'center',
                    right: null,
                    bottom: null,
                    data: data.value
                }]
            });
        }
    </script>
</body>
</html>
{% endblock %}